package com.yang.controller;

//import com.sun.tools.internal.ws.processor.model.Model;
//import com.sun.tools.internal.xjc.model.Model;
import com.yang.entity.User;
import com.yang.service.UserService;
import org.apache.shiro.web.session.HttpServletSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

/**
 * Created by Administrator on 2019/6/30.
 */
@Controller
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("inputlogin")
    public String inputloin(){
        return "user/login";
    }

    @RequestMapping("inputmain")
   public String iuputmain(){
        return "user/main";
   }

    @RequestMapping("inputsearchShow")
    public String iuputsearch(){
        return "user/searchShow";
    }

    @RequestMapping("inputshowPage")
    public String inputshowPage(){
        return "showPage";
    }


    @RequestMapping("/login")
    @ResponseBody
    public String login(String username, String password, HttpSession session) {
         User user=userService.selectByPasswordAndName(username, password);
        if (user!=null) {
            return "SUCCESS";
        } else {
            //进入管理页面，比如发博客
            return "FALSE";
        }
    }
}
